package project1;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

@Gomoku_Component("保存按钮事件监听类")
public class SaveButtonListener implements ActionListener {
    SaveGomoku sg = new SaveGomoku();
    DrawGomoku dg = new DrawGomoku();
    public SaveButtonListener(SaveGomoku sg, DrawGomoku dg) {
        this.sg = sg;
        this.dg = dg;
    }


    @Override
    public void actionPerformed(ActionEvent e) {
        try {
            sg.save(dg);
            System.out.println("棋盘保存成功！");
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}
